<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    var year = Number(prompt('输入一个年份'))
    var a=2024;
    var c=a-year
    if(c>=0 && c<11){
        alert(c+'岁是儿童')
    }else if(c>=11 && c<18){
        alert(c+'岁是青少年')
    }else if(c>=18 && c<50){
        alert(c+'岁是成人')
    }else if(c>=50){
        alert(c+'岁是老年人')
    }
</script>